<?php
namespace App\Services;

use App\Plugins\PluginInfo;

class ServiceFactory
{
    const REPO_SERVICE = '\\App\\Services\\Repo\\';
    const PLUGIN_SERVICE = '\\App\\Plugins\\Shh\\Services\\';

    public function createService($resouce) {
        $pluginInfo = PluginInfo::getInstance();
        if ($pluginInfo->getplugin()) {
            $serviceName = self::PLUGIN_SERVICE . ucfirst($resouce) . 'Service';
            if (class_exists($serviceName)){
                return new $serviceName();
            }
        }
        $serviceName = self::REPO_SERVICE . ucfirst($resouce) . 'Repo';
        return new $serviceName();
    }
}